<#if matchProjectItem??>
<script type="text/javascript">
	//表格查询  
	function reloadMatchAccount${linkType!}${matchProjectId!}() {
		var params = matchAccount_list_${linkType!}${matchProjectId!}.datagrid('options').queryParams; //先取得 datagrid 的查询参数  
		printLog(params);
		matchAccount_list_${linkType!}${matchProjectId!}.datagrid('reload'); //设置好查询参数 reload 一下就可以了  
		matchAccount_list_${linkType!}${matchProjectId!}.datagrid('unselectAll');
		matchAccount_list_${linkType!}${matchProjectId!}.datagrid('uncheckAll');
	}


	function addMatchAccount${linkType!}${matchProjectId!}() {
		createFromWindow("新增信息", "matchAccount.do?editMatchAccount&linkType=${linkType!}", "matchAccount.do?saveMatchAccount&linkType=${linkType!}&matchProjectId=${matchProjectId!}",
				function(data) {
					reloadMatchAccount${linkType!}${matchProjectId!}();
				});
	}
	
	function deleteMatchAccount${linkType!}${matchProjectId!}() {
		var rows = matchAccount_list_${linkType!}${matchProjectId!}.datagrid('getChecked');
	    if (rows&&rows.length>0){
	        $.messager.confirm('询问','你确认要删除吗?',function(r){
	            if (r){
	            	var ids = "";
	            	for(var i=0; i<rows.length; i++){
	            		ids += rows[i].id+",";
	            	}
	                $.post('matchAccount.do?deleteMatchAccountItems',{ids:ids},function(result){
	                    if (result.success){
	                    	reloadMatchAccount${linkType!}${matchProjectId!}();    
	                    }
	                    showMsg(result.msg);
	                },'json');
	            }
	        });
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}

	function editMatchAccount${linkType!}${matchProjectId!}() {
		var rows = matchAccount_list_${linkType!}${matchProjectId!}.datagrid('getChecked');
		printLog(rows);
		if (rows&&rows.length>0) {
			if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
			createFromWindow("编辑信息", "matchAccount.do?editMatchAccount&linkType=${linkType!}&matchAccountId=" + rows[0].id,
					"matchAccount.do?saveMatchAccount&linkType=${linkType!}&matchProjectId=${matchProjectId!}", function(data) {
						reloadMatchAccount${linkType!}${matchProjectId!}();
					},true);
		} else {
			showMsg('请选择操作记录.');
		}

	}
	
	
	function clearMatchAccountSearch${linkType!}${matchProjectId!}() {
		setGridSearchParams('matchAccount_list_${linkType!}${matchProjectId!}','matchAccountSearchForm${linkType!}${matchProjectId!}',true,reloadMatchAccount${linkType!}${matchProjectId!});
	}
	
	//根据条件查询
	function matchAccountSearch${linkType!}${matchProjectId!}() {
		setGridSearchParams('matchAccount_list_${linkType!}${matchProjectId!}','matchAccountSearchForm${linkType!}${matchProjectId!}',false,reloadMatchAccount${linkType!}${matchProjectId!});
	}
	
	function onDblClickMatchAccountRow${linkType!}${matchProjectId!}(rowIndex, rowData) {
		createFromWindow("编辑信息", "matchAccount.do?editMatchAccount&matchAccountId=" + rowData.id,
					"matchAccount.do?saveMatchAccount&linkType=${linkType!}&matchProjectId=${matchProjectId!}", function(data) {
						reloadMatchAccount${linkType!}${matchProjectId!}();
					},true);
	}
	
	/**
	 * 禁用用户
	 */
	function disableMatchAccount${linkType!}${matchProjectId!}(userId) {
		 var rows = matchAccount_list_${linkType!}${matchProjectId!}.datagrid('getChecked');
	    if (rows&&rows.length>0){
	        $.messager.confirm('询问','你确认要禁用用户吗?',function(r){
	        	if (r){
	            	var ids = "";
	            	for(var i=0; i<rows.length; i++){
	            		ids += rows[i].id+",";
	            	}
	                $.post('user.do?disableUserItems',{ids:ids},function(result){
	                    if (result.success){
	                    	reloadMatchAccount${linkType!}${matchProjectId!}();    
	                    }
	                    showMsg(result.msg);
	                },'json');
	            }
	        });
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}
	/**
	 * 启用用户
	 */
	function enableMatchAccount${linkType!}${matchProjectId!}() {
		var rows = matchAccount_list_${linkType!}${matchProjectId!}.datagrid('getChecked');
	    if (rows&&rows.length>0){
	        $.messager.confirm('询问','你确认要启用用户吗?',function(r){
	        	if (r){
	            	var ids = "";
	            	for(var i=0; i<rows.length; i++){
	            		ids += rows[i].id+",";
	            	}
	                $.post('user.do?enableUserItems',{ids:ids},function(result){
	                    if (result.success){
	                    	reloadMatchAccount${linkType!}${matchProjectId!}();    
	                    }
	                    showMsg(result.msg);
	                },'json');
	            }
	        });
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}
	
	/**重置密码
	 */
	 
	function resetMatchAccount${linkType!}${matchProjectId!}() {
		
		var rows = matchAccount_list_${linkType!}${matchProjectId!}.datagrid('getChecked');
		printLog(rows);
		if (rows&&rows.length>0) {
			if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
			 $.messager.confirm('询问','你确认要重置密码吗?',function(r){
		        	if (r){
		        		$.post('user.do?resetPwd=888888',{ids:rows[0].id},function(result){
		                    if (result.success){
		                    	reloadMatchAccount${linkType!}${matchProjectId!}();    
		                    }
		                    showMsg(result.msg);
		                },'json');
		        	}
			 });
		 	
		} else {
			showMsg('请选择操作记录.');
		}
	}
</script>


<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		<@eu.datagrid id="matchAccount_list_${linkType!}${matchProjectId!}" toolbar="#matchAccountlist_search_${linkType!}${matchProjectId!}" idField="id"  url="matchAccount.do?loadList&matchProjectId=${matchProjectId!}&linkType=${linkType!}" rownumbers="true" onDblClickRow="onDblClickMatchAccountRow(rowIndex, rowData)"
			 item="com.xdtech.match.vo.MatchAccountItem"/>
		
		<div id="matchAccountlist_search_${linkType!}${matchProjectId!}">
			<div style="margin-bottom:5px;padding-left:5px;margin-top: 5px;">
				<form id="matchAccountSearchForm${linkType!}${matchProjectId!}">
					<!-- 防止form表单里只有一个text元素时候，按enter键自动提交问题 -->
					<input style="display:none" />
					<table>
						<tr>
							<td colspan="2">
							当前赛事：${(matchProjectItem.matName)!}
							</td>
						</tr>
					</table>
					<table>
						<tr>
							<td>单位名称：</td>
							<td>
								<@eu.comboBox name="companyName" url="common.do?loadComboBox&key=MATCH_COMPANY_INFO" />
							</td>
							<td>
							<td>部门：</td>
							<td><input class="easyui-validatebox textbox" name="dept" style="width: 150px"/></td>
							<td>
								<@eu.linkbutton showName="查询" iconCls="icon-search" onclick="matchAccountSearch${linkType!}${matchProjectId!}()"/>
	 					 		<@eu.linkbutton showName="清空" iconCls="icon-clear" onclick="clearMatchAccountSearch${linkType!}${matchProjectId!}()"/>
 					 		</td>
						</tr>
					</table>
				</form>
				
			</div>
			<div id="matchAccount_toolbar" style="height: auto">
				<@eu.linkbutton showName="新增" shiro="match:matchAccount:add" iconCls="icon-add" onclick="addMatchAccount${linkType!}${matchProjectId!}()"/>
				<@eu.linkbutton showName="删除" shiro="match:matchAccount:delete" iconCls="icon-remove" onclick="deleteMatchAccount${linkType!}${matchProjectId!}()"/>
				<@eu.linkbutton showName="编辑" shiro="match:matchAccount:edit" iconCls="icon-edit" onclick="editMatchAccount${linkType!}${matchProjectId!}()"/>
				<@eu.linkbutton showName="禁用" shiro="match:matchAccount:disable" iconCls="icon-disable" onclick="disableMatchAccount${linkType!}${matchProjectId!}()"/>
				<@eu.linkbutton showName="启用" shiro="match:matchAccount:enable" iconCls="icon-ok" onclick="enableMatchAccount${linkType!}${matchProjectId!}()"/>
				<@eu.linkbutton showName="重置密码" shiro="match:matchAccount:resetPwd" iconCls="icon-reload" onclick="resetMatchAccount${linkType!}${matchProjectId!}()"/>
				<@eu.linkbutton showName="刷新" shiro="match:matchAccount:refresh" iconCls="icon-reload" onclick="reloadMatchAccount${linkType!}${matchProjectId!}()"/>
			</div>
		</div>
	</div>
</div>
<#else>
未进入赛事选择操作，无法进行相关对应帐号/报名操作，请进行参赛报名登录或联系管理员！
</#if>